#include "MainMenuDlg.h"
#include "Game.h"
#include "CEGUISystem.h"
#include "CEGUIWindow.h"
#include "CEGUIWindowManager.h"
#include "elements/CEGUIPushButton.h"
#include "ScriptingModules/LuaScriptModule/CEGUILua.h"

MainMenuDlg::MainMenuDlg(CEGUI::System *pSystem, CEGUI::Window *pSheet, CGame *pSimulation)
{
	m_pSystem = pSystem;
	m_pWindow = pSheet;
//	m_pSimulation = pSimulation;
    //CEGUI::System::getSingleton().executeScriptFile("./handler/handler.lua", "GUI");
//    CEGUI::System::getSingleton().executeScriptFile("./handler/init_handler.lua", "GUI");
 
	//// hook up the event handlers to the window elements
	//CEGUI::PushButton* pQuitButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdQuit");
 //   //	pQuitButton->subscribeScriptedEvent(CEGUI::PushButton::EventClicked, "Quit_OnClick");
 //   //	pQuitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuDlg::Quit_OnClick, this));

	//CEGUI::PushButton* pOptionsButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdOptions");
	//pOptionsButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuDlg::Options_OnClick, this));

	//CEGUI::PushButton* pLaunchButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdInstantAction");
	//pLaunchButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuDlg::Launch_OnClick, this));
}

MainMenuDlg::~MainMenuDlg()
{
 //   lua_close(mLuaState);
}

bool MainMenuDlg::Quit_OnClick(const CEGUI::EventArgs &args)
{
    CGame::getSingleton().requestStateChange(SHUTDOWN);
	return true;
}

bool MainMenuDlg::Launch_OnClick(const CEGUI::EventArgs &args)
{
	return true;
}

bool MainMenuDlg::Options_OnClick(const CEGUI::EventArgs &args)
{
	return true;
}
